{extend name="public/menu3" /}
{block name='title'}-{$cur.name}{/block}

{block name='content'}
<div class="right_content">
    <ul class="list">
        <!-- start -->
        {foreach $news as $k=>$v}
        {php}$newsid = $v['id'];{/php}
        <li>
            <a href='{:url("/newsdetails/$newsid")}'>
                <p class="image"><img src="{$v.thumb ?: ''}" alt=""></p>
                <div class="content">
                    <p class="title a_row">{$v.title ?: ''}</p>
                    <p class="sub_title">作者：{$v.author ?: ''} | 发布时间 ：{$v.create_at|format_datetime='Y-m-d'}</p>
                    <p class="brief">{$v.desc|default=''}</p>
                    <span class="btn" target="_blank" href='{:url("/newsdetails/$newsid")}'>了解详情</span>
                </div>
            </a>
        </li>
        {/foreach}
        <!-- end -->
    </ul>
    <div id="page">

    </div>
</div>
</div>
{/block}

{block name='script'}
<style>
    #content .list li a {
        display: flex;
        margin-bottom: 40px;
    }

    #content .list li:hover {
        box-shadow: 0 7px 15px #ddd;
    }

    #content .list li .image {
        width: 270px;
        height: 270px;
    }

    #content .list li .content {
        padding: 0 20px 0 30px;
        flex: 1;
        overflow: hidden;
    }

    #content .list li .title {
        font-size: 30px;
    }

    #content .list li .sub_title {
        font-size: 14px;
        line-height: 2.5;
        color: #959595;
    }

    #content .list li .brief {
        margin: 50px 0 30px;
        font-size: 14px;
        line-height: 2;
        color: #959595;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        overflow: hidden;
        text-overflow: ellipsis;
        -webkit-box-orient: vertical;
    }

    #content .list li .btn {
        display: block;
        width: 100px;
        height: 40px;
        line-height: 40px;
        background-color: #8f000b;
        border-radius: 3px;
        text-align: center;
        color: #fff;
    }
</style>
<script src="__STATIC__/index/js/jquery.page.js"></script>

<script>
    $(function () {
        //获取url参数
        function getQueryValue(key) {
            var match = location.search.match(new RegExp(key + '=([^&]*)'));
            return match && match[1] || '';
        }
        // 当前页码
        var page = getQueryValue("page") || 1;
        page = parseInt(page);
        // 总页数
        var pageCount = {$total ?: '1'};
        if (pageCount == 1) {
            $("#page").hide();
        }
        $("#page").createPage({
            current: page,
            pageCount: pageCount,
            backFn: function (p) {
                //p是当前页码
                location.href = "?state=" + state + "&page=" + p;
            }
        });
    })
</script>

{/block}